package com.jzmy.employment.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;

/**
 * @author mengzhichao
 * @create 2022-09-17-9:46
 */
@Configuration
public class UTF8 {
        @Bean
        public FilterRegistrationBean filterRegistrationBean() {
            FilterRegistrationBean registrationBean = new FilterRegistrationBean();
            CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
            characterEncodingFilter.setForceEncoding(true);
            characterEncodingFilter.setEncoding("utf-8");
            registrationBean.setFilter(characterEncodingFilter);
            return registrationBean;
        }

}
